<?php 

function berichtmail($betreff, $text)
{

	$empfaenger = "mau04@online.de";
	$absendername = "FH360 Spielberichte";
	$absendermail = "registration@fifahouse360.de";
	mail($empfaenger, $betreff, $text, "From: $absendername <$absendermail>");

}

function mailMatch($mid)
{
	include("joomlaInt_admin.php");
	include("inc_configuration.php");
	
	$q = "	SELECT
				m.homeG AS hg,
				m.guestG AS gg,
				u1.username AS hu,
				u2.username AS gu,
				t1.name AS ht,
				t2.name AS gt
			FROM
				$tbl_matches m,
				$tbl_combinations c1,
				$tbl_combinations c2,
				$tbl_users u1,
				$tbl_users u2,
				$tbl_teams t1,
				$tbl_teams t2
			WHERE
				m.homeC = c1.id AND
				m.guestC = c2.id AND
				c1.userId = u1.id AND
				c2.userId = u2.id AND
				c1.teamId = t1.id AND
				c2.teamId = t2.id AND
				m.id = $mid";
				
	$qe = mysql_query($q);
	
	$qeo = mysql_fetch_object($qe);
	
	$hg=$qeo->hg;
	$gg=$qeo->gg;
	$hu=$qeo->hu;
	$gu=$qeo->gu;
	$ht=$qeo->ht;
	$gt=$qeo->gt;
	
	
	$mailtext = '<html>
	<head>
		<title>Spielbericht</title>
	</head>
	 
	<body>
	 
	<h1>Neues Spiel</h1>';

	$mailtext.= "Es wurde ein neues Spiel eingetragen:<br>
				<table>
					<tr>
						<td><center>$ht</center></td>
						<td><center>-</center></td>
						<td><center>$gt</center></td>
					</tr>
					<tr>
						<td><center>$hu</center></td>
						<td><center>-</center></td>
						<td><center>$gu</center></td>
					</tr>
					<tr>
						<td><center>$hg</center></td>
						<td><center>-</center></td>
						<td><center>$gg</center></td>
					</tr>
				</table>";

	$mailtext.='
	</body>
	</html>
	';
	 
	$empfaenger = $spielberichtempmail; //Mailadresse
	$absender   = $spielberichtabsmail;
	$betreff    = "$ht - $gt";
	$antwortan  = "registration@fifahouse360.de";
	$absendername = "FH360 Spielberichte";
	 
	$header  = "MIME-Version: 1.0\r\n";
	$header .= "Content-type: text/html; charset=iso-8859-1\r\n";
	 
	$header .= "From: $absendername  <$absender>";
	$header .= "Reply-To: $antwortan\r\n";
	// $header .= "Cc: $cc\r\n";  // falls an CC gesendet werden soll
	$header .= "X-Mailer: PHP ". phpversion();
	 
	mail( $empfaenger,
		  $betreff,
		  $mailtext,
		  $header);
}

?>